/**
 * Created by woziji00226 on 2025-01-07 14:34:08.
 */
class SegmentGameData_W26 {
    private static _gameData: SegmentGameData_W26;

    private _levels: any[]

    constructor() {

    }



    /**
     * 得到当前关卡的数据 假如关卡超出以后，则返回null;
     * @param level 
     * @param x 
     * @param y 
     * @param p1 
     * @param p2 
     * { points: { x: number, y: number }[], segments: { p1: number, p2: number }[] }
     * points每个点的坐标
     * segments 连接两个点的线段
     */
    public getLevelData(level: number): SegmentData_W26 {
        if (level > this.levels.length - 1) {
            return null;
        }
        if (level < 0) {
            return null;
        }

        var data = this.levels[level];

        var points = [];
        var segments = [];

        for (var i = 0; i < data[0].length; i++) {
            points.push(new SegmentData_Point_W26(data[0][i][0], data[0][i][1]));
        }
        for (var i = 0; i < data[1].length; i++) {
            segments.push(new SegmentData_segment_W26(data[1][i][0], data[1][i][1]));
        }

        return new SegmentData_W26(points, segments);
    }



    /**
     * 得到最大的关卡数量
     */
    public get maxLevel() {
        return this.levels.length - 1;
    }



    public static get GameData() {
        if (this._gameData == null) {
            this._gameData = new SegmentGameData_W26();
        }
        return this._gameData;
    }



    /**
     * 获取关卡信息
     */
    private get levels() {
        if (this._levels == null) {
            this._levels =
                [
                    null,
                    //[[[94, 96], [263, 72], [40, 330], [120, 120]], [[0, 1], [0, 2], [0, 3], [1, 2], [1, 3], [2, 3]]],
                    [[[94, 96], [263, 72], [40, 330], [273, 343]], [[0, 1], [0, 2], [0, 3], [1, 2], [1, 3], [2, 3]]],
                    [[[173, 86], [240, 305], [63, 223], [254, 111], [143, 314]], [[0, 1], [0, 2], [0, 3], [0, 4], [1, 3], [2, 3], [3, 4]]],
                    [[[168, 60], [173, 316], [233, 266], [215, 143], [105, 317], [58, 137]], [[0, 3], [0, 4], [1, 3], [1, 5], [2, 3], [2, 4], [2, 5]]],
                    [[[127, 71], [213, 155], [152, 317], [224, 237], [70, 272], [65, 193]], [[0, 2], [0, 5], [1, 4], [1, 5], [3, 4], [3, 5]]],
                    [[[247, 296], [95, 278], [163, 71], [58, 148], [278, 151], [171, 332]], [[0, 2], [1, 2], [1, 3], [1, 4], [2, 3], [2, 4], [2, 5], [3, 4], [4, 5]]],
                    [[[38, 300], [123, 361], [173, 53], [258, 321], [284, 151], [72, 111]], [[0, 2], [0, 4], [0, 5], [1, 2], [1, 4], [1, 5], [2, 4], [3, 5]]],
                    [[[46, 125], [207, 370], [145, 201], [255, 213], [238, 161], [78, 329]], [[0, 1], [0, 2], [0, 4], [0, 5], [1, 3], [1, 5], [2, 3], [4, 5]]],
                    [[[45, 140], [130, 363], [41, 309], [174, 92], [250, 132], [285, 315]], [[0, 2], [0, 4], [0, 5], [1, 3], [1, 4], [1, 5], [2, 3], [2, 5], [4, 5]]],
                    [[[139, 335], [284, 193], [80, 273], [210, 80], [93, 134], [283, 314]], [[0, 1], [0, 3], [1, 3], [1, 4], [2, 3], [2, 4], [3, 4], [3, 5], [4, 5]]],
                    [[[258, 329], [202, 73], [67, 293], [273, 136], [173, 360], [60, 107]], [[0, 1], [0, 2], [0, 3], [1, 2], [1, 4], [1, 5], [2, 3], [2, 4], [2, 5], [3, 5], [4, 5]]],
                    [[[48, 341], [240, 136], [203, 345], [273, 290], [123, 96], [29, 138]], [[0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [1, 2], [1, 5], [2, 3], [2, 4], [2, 5], [3, 4]]],
                    [[[149, 212], [77, 232], [121, 138], [225, 220], [266, 100], [210, 337], [142, 329], [274, 319]], [[0, 1], [0, 6], [1, 3], [1, 4], [1, 6], [1, 7], [2, 3], [3, 4], [3, 5], [3, 6]]],
                    [[[264, 246], [77, 97], [65, 304], [175, 344], [202, 137], [263, 117]], [[0, 1], [0, 2], [0, 3], [0, 4], [1, 2], [1, 3], [1, 5], [3, 5], [4, 5]]],
                    [[[103, 335], [184, 336], [239, 253], [35, 262], [187, 141], [69, 157]], [[0, 1], [0, 2], [0, 5], [1, 4], [1, 5], [2, 3], [2, 4], [2, 5], [3, 4], [4, 5]]],
                    [[[71, 109], [266, 286], [66, 217], [117, 313], [206, 346], [246, 88], [274, 192], [180, 180]], [[0, 1], [0, 2], [0, 4], [0, 6], [0, 7], [1, 3], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [3, 5], [3, 6], [5, 7]]],
                    [[[154, 255], [186, 191], [85, 279], [49, 167], [198, 93], [264, 178], [108, 111], [251, 298]], [[0, 5], [0, 6], [1, 2], [1, 4], [1, 7], [2, 3], [2, 4], [2, 6], [2, 7], [3, 6], [3, 7], [4, 6], [4, 7], [5, 6]]],
                    [[[218, 291], [250, 221], [151, 358], [48, 344], [76, 232], [47, 80], [270, 129], [175, 119]], [[0, 3], [0, 7], [1, 5], [1, 7], [2, 7], [3, 5], [3, 6], [3, 7], [4, 5], [4, 6], [5, 7]]],
                    [[[33, 204], [252, 91], [250, 191], [71, 353], [227, 246], [54, 272], [67, 142], [193, 316]], [[0, 1], [0, 2], [1, 2], [1, 3], [1, 5], [1, 6], [2, 6], [3, 4], [3, 5], [4, 6], [5, 6], [5, 7], [6, 7]]],
                    [[[143, 338], [146, 75], [98, 189], [285, 195], [257, 303], [278, 100], [66, 268], [44, 129]], [[0, 2], [0, 3], [0, 6], [1, 3], [2, 3], [2, 4], [2, 7], [3, 4], [3, 6], [5, 6], [5, 7]]],
                    [[[101, 70], [273, 225], [52, 159], [133, 339], [245, 334], [38, 279], [191, 248], [190, 79]], [[0, 1], [0, 3], [0, 6], [1, 2], [1, 3], [1, 4], [1, 7], [2, 3], [2, 4], [3, 5], [3, 7], [5, 7], [6, 7]]],
                    [[[169, 226], [74, 154], [51, 306], [213, 325], [267, 174], [39, 212], [192, 192], [121, 377], [131, 90], [247, 238]], [[0, 2], [1, 2], [1, 6], [2, 3], [2, 9], [3, 5], [4, 6], [4, 7], [5, 9], [6, 9], [7, 8]]],
                    [[[55, 149], [189, 316], [239, 188], [300, 213], [276, 285], [217, 58], [114, 294]], [[0, 1], [0, 2], [0, 6], [1, 2], [1, 3], [1, 5], [2, 5], [2, 6], [3, 4], [3, 5], [4, 6], [5, 6]]],
                    [[[262, 193], [84, 113], [194, 82], [77, 280], [230, 288], [40, 183], [158, 346], [163, 218]], [[0, 5], [0, 6], [0, 7], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [2, 3], [2, 4], [2, 6], [3, 4], [3, 6], [3, 7], [5, 6], [5, 7]]],
                    [[[287, 190], [131, 201], [255, 289], [60, 194], [163, 74], [246, 87], [66, 281], [184, 312]], [[0, 1], [0, 2], [0, 4], [0, 7], [1, 4], [2, 3], [2, 5], [2, 7], [3, 4], [3, 7], [4, 5], [4, 6], [4, 7], [6, 7]]],
                    [[[228, 100], [259, 147], [276, 307], [173, 321], [61, 161], [55, 237], [126, 81], [118, 134]], [[0, 2], [0, 5], [0, 6], [1, 5], [1, 6], [2, 4], [2, 5], [2, 6], [2, 7], [3, 5], [3, 7], [4, 6], [4, 7]]],
                    [[[104, 334], [266, 263], [262, 132], [92, 102], [170, 287], [225, 336], [158, 52], [55, 214]], [[0, 3], [0, 5], [0, 6], [0, 7], [1, 2], [1, 5], [1, 6], [1, 7], [2, 3], [2, 4], [3, 4], [4, 7], [5, 6]]],
                    [[[291, 165], [158, 341], [53, 219], [159, 216], [220, 48], [80, 124], [188, 121], [272, 325]], [[0, 1], [0, 5], [1, 5], [1, 7], [2, 3], [2, 6], [2, 7], [3, 6], [3, 7], [4, 5], [4, 6], [4, 7], [5, 6], [6, 7]]],
                    [[[203, 287], [258, 151], [65, 305], [256, 262], [90, 91], [178, 86], [38, 214], [129, 316]], [[0, 1], [0, 6], [0, 7], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [2, 4], [2, 5], [3, 4], [4, 6], [6, 7]]],
                    [[[209, 182], [151, 299], [176, 56], [50, 169], [98, 106], [109, 168], [284, 290], [279, 116]], [[0, 2], [0, 7], [1, 3], [1, 5], [1, 6], [2, 4], [2, 5], [2, 6], [3, 5], [3, 6], [4, 5], [4, 6], [5, 6], [5, 7], [6, 7]]],
                    [[[136, 186], [243, 111], [55, 302], [62, 106], [188, 317], [132, 89], [234, 218], [28, 189]], [[0, 1], [0, 2], [0, 3], [0, 4], [1, 2], [1, 3], [1, 5], [1, 6], [1, 7], [2, 5], [2, 6], [3, 4], [3, 5], [4, 5], [5, 6], [5, 7], [6, 7]]]
                ]
        }


        return this._levels;
    }
}